<?php
/**
 * main.php file.
 *
 * @author Yufan <nimanyi@gmail.com>
 * @link http://www.dedecms.cn/
 * @copyright Copyright &copy; 2010-2012 Yufan Software LLC
 * @license http://www.dedecms.cn/license/
 * @version $Id: main.php 2011-12-7 7:51:04 Yufan $
 * @since 1.0
 */
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'environment.php';
$params = require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'params.php';
return array(
        'id' => 'vipcha.com',
        'basePath' => dirname(__FILE__) . DS . '..',
        'name' => $params['sitename'],
        'charset' => $params['charset'],
        'language' => $params['language'],
        'layout' => 'main',
        'defaultController' => 'site',
        'theme' => $params['theme'],
        'timeZone' => $params['timezone'],
        // autoloading model and component classes
        'import' => array(
                'application.models.*',
                'application.components.*',
                'application.extensions.*',
        ),
        'modules' => array(
        // uncomment the following to enable the Gii tool

                'gii' => array(
                        'class' => 'system.gii.GiiModule',
                        'password' => 'admin',
                )
        ),
        // application components
        'components' => array(
                'user' => array(
                        'allowAutoLogin' => true,
                        'class' => 'WebUser',
                        'identityCookie' => array(
                                'path' => $params['cookiePath'],
                                'domain' => $params['cookieDomain'],
                        ),
                        //'guestName' => $params['guest'],
                        'loginUrl' => array('site/login'),
                ),
                // uncomment the following to enable URLs in path-format
                'urlManager' => array(
                        'urlFormat' => $params['urlFormat'],
                        'showScriptName' => false,
                        'urlSuffix' => '.html',
                        'rules' => array(
                        //'minify/<group:[^\/]+>'=>'minify/index',
                        //'ip-<ip>'=>'ip/index',
//                                '<_c:(ip|whois)>/<domain:(.+)>' => '<_c>/index',
//                                '<_c:(yto)>/<kdno:(.+)>' => '<_c>/index',
//                                '<_c:(icp)>-<type:(.+)>/<domain:(.+)>' => '<_c>/index',
//                                '<_c:(idcard)>/<cardno:(.+)>' => '<_c>/index',
//                                'http://<_c:(ip)\w+>.vipcha.com' => '<_c>/<_a>',
                        ),
                ),
                'db' => (defined('DB_CONNECTION') ? array(
                        'connectionString' => DB_CONNECTION,
                        'username' => DB_USER,
                        'password' => DB_PWD,
                        'enableParamLogging' => DB_LOGGING,
                        'tablePrefix' => DB_TBPREFIX,
                        'charset' => DB_CHARSET,
                        'emulatePrepare' => DB_PREPARE,
                        'schemaCacheID' => 'fcache'
                ) : array()),
                //assets 目录
                'assetManager' => array(
                        'basePath' => dirname(__FILE__) . '/../../assets',
                        'baseUrl' => $params['resourceBaseUrl'] . 'assets',
                ),
                //theme 目录
                'themeManager' => array(
                        'basePath' => dirname(__FILE__) . '/../../themes',
                        'baseUrl' => $params['resourceBaseUrl'] . 'themes',
                ),
                'errorHandler' => array(
                // use 'site/error' action to display errors
                        'errorAction' => 'site/error',
                ),
                'log' => array(
                        'class' => 'CLogRouter',
                        'routes' => array(
                                array(
                                        'class' => 'CFileLogRoute',
                                        'levels' => 'trace, info, error, warning, watch',
                                        'categories' => 'system.db.*',
                                ),
                                array(
                                        'class' => 'CWebLogRoute',
                                        'levels' => 'trace, info, error, warning',
                                        'categories' => 'system.db.*',
                                ),
                        ),
                ),
                'session' => array(
                        'sessionName' => md5('d^&&S*Df'),
                        'cookieParams' => array(
                                'path' => $params['cookiePath'],
                                'domain' => $params['cookieDomain'],
                        ),
                ),
//                //客户端加速部分
//                'minScript' => array(
//                        'class' => 'ext.minScript.components.ExtMinScript',
//                        'groupMap' => array(
//                                'js' => array(
//                                        '/themes/vipcha/scripts/bootstrap-alerts.js',
//                                ),
//                        ),
//                ),
//                'controllerMap' => array(
//                        'min' => 'ext.minScript.controllers.ExtMinScriptController',
//                ),
//                'request' => array(
//                        'class' => 'HttpRequest',
//                        'enableCsrfValidation' => false,
//                        'enableCookieValidation' => true,
//                        'csrfTokenName' => 'vipcha.com',
//                        'noCsrfValidationRoutes' => array('site/upload'),
//                ),
//                'upload' => array(
//                        'class' => 'FileUpload',
//                ),
//                'curl' => array(
//                        'class' => 'ext.curl.Curl',
//                        'options' => array(
//                                'timeout' => 0,
////                                'setOptions'=>array(
////                                        CURLOPT_UPLOAD => true,
////                                        CURLOPT_USERAGENT => Yii::app()->params['agent'],
////                                ),
//                        )
//                //you can setup timeout,http_login,proxy,proxylogin,cookie, and setOPTIONS
//                )
        ),
        // application-level parameters that can be accessed
        // using Yii::app()->params['paramName']
        'params' => $params,
);